﻿@model sBlog.Net.Domain.Entities.UserEntity
<script type="text/javascript">
    $(document).ready(function () {
        $('#newBlash').hide();
        $('#uploadAvatar').hide();
        $('#uploadCover').hide();

        $("#Splash").keyup(function (e) {
            if (e.keyCode == 13) {
                updateBlash();
                return false;
            }
        });

        $("#Splash").keydown(function (e) {
            if (e.keyCode == 13) {
                updateBlash();
                return false;
            }
        });
    });

    function follow() {
        var noCache = new Date().toString();
        $.getJSON('@Url.Content("~/Author/follow?followerUserId=" + @Model.UserID)', { noCache: noCache }, function (data) {
            var inputText = document.getElementById("textFollow");
            inputText.value = data;
        });
    }

    function editBlash() {
        $('#newBlash').show();
        $('#orginalBlash').hide();
    }

    function cancel() {
        $('#newBlash').hide();
        $('#orginalBlash').show();
    }

    function updateBlash() {
        var Blash = document.getElementById("Splash").value;
        var noCache = new Date().toString();

        $.getJSON('/Author/updateBlash?blash=' + Blash, { noCache: noCache }, function (data) {
            var newBlash = document.getElementById("orginalBlash");
            newBlash.innerHTML = data;
        });

        cancel();
    }

    function editAvatar() {
        $('#editAvatar').hide();
        $('#uploadAvatar').show();
    }
</script>
<div class="userProfile" style="height: 50px;">
    <div class="blash" style="height: 25px;">
        <div class="left">
            <img src="@Url.Content("~/Content/Images/MlogThem/splash-1.png")" width="41" height="27" alt="blash"/>
        </div>
        <div class="middle">
            <div id="orginalBlash">@Model.Splash</div>
            <span id="newBlash">@Html.TextBoxFor(model => model.Splash, new { Style = "width:700px;" })
                <span class="urlControls">
                    <input type="button" id="btnUpdate" onclick="return updateBlash();" value="ok" />&nbsp;<input
                        type="button" id="btnCancel" value="cancel" onclick="return cancel();" />
                </span></span>
        </div>
        <div class="right">
            <img src="@Url.Content("~/Content/Images/MlogThem/splash-2.png")" width="41" height="27" alt="blash"/>&nbsp;
            @if (User.Identity.IsAuthenticated)
            {
                if (Membership.GetUser().UserName.Equals(@Model.UserName))
                { 
                <img src="@Url.Content("~/Content/Images/MlogThem/compose-icon-homeuser.png")"onclick="return editBlash();" style="cursor: pointer;" width="16" height="16" alt="editblash"/>
                }
            }
        </div>
    </div>
    <div class="userInfo">
        <div class="infomation" style="height: 50px; border: none 0;">
            <div style="width: 40px; float: left;">
                <img id="avatar" src="@Url.Content("http://s1.img.yan.vn/Mlog/UploadUserAvatar/30x30_" + Model.Avatar)" class="imgAvatar" style="border: none 0;" width="30" height="30" alt="user avatar"/><br />
            </div>
            <div style="float: left;">
                <span style="color: #46739F; font-family: sfufuturaregular; font-weight: bold; text-transform: uppercase;
                    font-size: 1.5em;">@Model.UserDisplayName </span>
                @Model.JobDescription
            </div>
        </div>
    </div>
</div>
